﻿using Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 超市收银台
{
    public partial class GoodsBuy : Form
    {
        private List<GoodsInfo> list = new List<GoodsInfo>();
        public GoodsBuy(List<GoodsInfo> a)
        {
            InitializeComponent();
            list = a;
        }
        public int Goods { get; set; }
        private void Dgv_xianshi_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (Dgv_xianshi.SelectedRows.Count == 1)
                {
                    int index = Dgv_xianshi.SelectedRows[0].Index;
                    Goods = index - 1;
                    this.Close();
                }
            }
        }
        private void GoodsBuy_Load(object sender, EventArgs e)
        {
            Dgv_xianshi.AutoGenerateColumns = false;

            Dgv_xianshi.DataSource = new BindingList<GoodsInfo>(list);
        }


    }
}
